-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve endianness validation strategy #10
base: main
Are you sure you want to change the base?
Conversation
Looks like you forgot to attach the actual cpp code files |
cpp/BloomFilter.hpp
Outdated
#define IS_BIG_ENDIAN 1 | ||
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) | ||
#define IS_BIG_ENDIAN 0 | ||
#error "Big endian systems are not supported for compilation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the wording to "TODO: Big Endian support"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
@@ -21,28 +21,37 @@ interface BloomFilterModule extends EmscriptenModule { | |||
UTF8ToString: (ptr: number) => string; | |||
} | |||
|
|||
function checkEndianness(): boolean { | |||
const buffer = new ArrayBuffer(2); | |||
new DataView(buffer).setInt16(0, 256, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change it to a call to a CPP function that returns an endian value. We really care about the endianess of the WASM runtime not of the JS runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea for later.
Fixed #9